require "premake/core"
require "premake/android/androidmk"
require "Config"

workspace "ZuiLib"
	configurations { "Debug", "Release" }
	exceptionhandling "On"
	if is_pfm("android") then
		location "android_studio/app/jni"
	else
		location "build"
	end
	
	if is_pfm("windows") then
        defines {
			"WIN32",
			"_WIN32",
			"_CRT_SECURE_NO_WARNINGS",
			"_CRT_NONSTDC_NO_DEPRECATE",
			"_WINSOCK_DEPRECATED_NO_WARNINGS",
			"HAVE_ALLOCA",
			"WINDOWS_IGNORE_PACKING_MISMATCH",
		}
		flags { "StaticRuntime" }
	elseif is_pfm("macosx") then
		defines { "__APPLE__", "MACOSX","POSIX"}
		xcodebuildsettings{
			--["SDKROOT"] = "iphoneos",
			--["TARGETED_DEVICE_FAMILY"] = "1,2",
			--["IPHONEOS_DEPLOYMENT_TARGET"] = "8.4",
			
			["ALWAYS_SEARCH_USER_PATHS"] = "YES",
			["CLANG_CXX_LANGUAGE_STANDARD"] = "gnu++0x",
			["CLANG_CXX_LIBRARY"]= "libc++",
			["CLANG_ENABLE_OBJC_ARC"] = "YES",
		}
	elseif is_pfm("linux") then
		defines { "LINUX", "linux" ,"POSIX"}
	elseif is_pfm("android") then
		defines {"__ANDROID__"}
	end

	
	
	if Config.support_video_control then
		defines{"SUPPORT_VIDEO_CONTROL"}
	end	
	

	filter "configurations:Debug"
		defines { "DEBUG" , "_DEBUG" ,"SDL_STATICLIB"}
		flags { "Symbols" }
		optimize "Debug"
		
	if is_pfm("windows") then
		defines { "_CRTDBG_MAP_ALLOC","DEBUG_MALLOC"}
	end
		
	filter "configurations:Release"
		defines { "NDEBUG" ,"SDL_STATICLIB"}
		optimize "On"
		flags { "OptimizeSpeed", "EnableSSE2"}
	
group "3dparty"
include "ZUI/thirdParty/curl/"
include "ZUI/thirdParty/zlib/"
include "ZUI/thirdParty/lua/"
include "ZUI/thirdParty/libpng/"
include "ZUI/thirdParty/freetype/"
include "ZUI/thirdParty/TTF/"
include "ZUI/thirdParty/mbedtls/"
include "ZUI/thirdParty/SDL2/"
include "ZUI/thirdParty/libwebp/"
include "ZUI/thirdParty/jpeg/"
include "ZUI/thirdParty/sdl_image/"
include "ZUI/thirdParty/libunibreak/"

include "ZUI/thirdParty/snappy/"
include "ZUI/thirdParty/leveldb/"

include "ZUI/thirdParty/ijkplayer/"

group "project"
include "ZUI"
include "ZUI/script"
include "ZUI/main/"

if Config.support_video_control then
	include "ZUI/videoControl/"
end
